using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace IHMainApp
{
    public static class TreeViewFillersUtility
    {
        /*public static void FillWithDevices(TreeView tv, DomainModel model)
        {            
            var Nodes = new Queue<Node>();
            var Deep = new Queue<int>();
            var TreeNodes = new Queue<TreeNode>();
            Node nod;
            int n;
            TreeNode tnode, ptnode;
            foreach (Device dev in model.Devices)
            {
                tnode = new TreeNode();
                tnode.Text = dev.Name;
                tnode.ToolTipText = dev.Comments;
                tnode.Tag=dev;                
                tv.Nodes.Add(tnode);

                foreach (Node no in dev.Nodes) Nodes.Enqueue(no);
                Deep.Enqueue(dev.Nodes.Count);
                TreeNodes.Enqueue(tnode);

                //TODO: all
                while (Nodes.Count > 0)
                {
                    n = Deep.Dequeue();
                    ptnode = TreeNodes.Dequeue();
                    for (int i = 0; i < n; i++)
                    {
                        nod = Nodes.Dequeue();
                        tnode = new TreeNode();
                        tnode.Text = nod.Name;
                        tnode.ToolTipText = nod.Comments;
                        tnode.Tag = nod;
                        ptnode.Nodes.Add(tnode);

                        TreeNodes.Enqueue(tnode);
                        Deep.Enqueue(nod.Nodes.Count);
                        foreach (Node no in nod.Nodes) Nodes.Enqueue(no);
                    }
                }
            }
        }

        public static void FillWithMethods(ListView lv, Node n)
        {
            foreach (Method m in n.Methods)
            {
                ListViewItem lvi=lv.Items.Add(m.Name);
                lvi.ToolTipText = m.Comments;
            }
        }

        public static void FillWithFilePaths(TreeView lv, IList<string> list)
        {
            TreeNode tnode;
            foreach (string m in list)
            {
                tnode = new TreeNode(Path.GetFileName(m));
                tnode.Tag = m;
                lv.Nodes.Add(tnode);
            }
        }*/
    }
}